home *** CD-ROM | disk | FTP | other *** search
/ PCMania 32 / PCMania CD32_2.iso / sharewar / util / scroll / tsrscrol.cpp < prev    next >
C/C++ Source or Header  |  1995-01-06  |  2KB  |  64 lines

  1. #include <dos.h>
  2. #include <stdio.h>
  3. #include <bios.h>
  4. #include <stdlib.h>
  5.  
  6. #define INTR 0x1C
  7.  
  8. #ifdef __cplusplus
  9.     #define __CPPARGS ...
  10. #else
  11.     #define __CPPARGS
  12. #endif
  13.  
  14. union REGS inregs, outregs;
  15. struct SREGS segs;
  16.  
  17. #define ALT_A           7680
  18. #define ALT_B          12288
  19.  
  20. volatile   char  mapa_teclado[256];
  21.  
  22. extern unsigned _heaplen = 1024;
  23. extern unsigned _stklen  = 512;
  24. int tec_puls;
  25. int tecl=ALT_A;
  26. char dentro=0;
  27. int up=0;
  28. int down=0;
  29. int left=0;
  30. int right=0;
  31.  
  32. void interrupt ( *oldhandler)(__CPPARGS);
  33. extern "C" void  SCROLL(int);
  34.  
  35. typedef unsigned int (far *s_arrayptr);
  36.  
  37. void interrupt handler(__CPPARGS)
  38. {
  39.     if(bioskey(1)) tec_puls=bioskey(0);
  40.     if (tec_puls==tecl)
  41.     {
  42.         for (int z1=0; z1<up; z1++) SCROLL(1);
  43.         for (int z2=0; z2<down; z2++) SCROLL(2);
  44.         for (int z3=0; z3<left; z3++) SCROLL(3);
  45.         for (int z4=0; z4<right; z4++) SCROLL(4);
  46.       if (tecl==ALT_A) tecl=ALT_B; else tecl=ALT_A;
  47.     }
  48.     oldhandler();
  49. }
  50.  
  51. int main(int argc, char* argv[])
  52. {
  53.     if (argc!=5) {printf("\nFormato: TSRSCROL up down left right\n\n  (siendo <up> <down> ...  un valor en pixels\nEjemplo: TSRSCROL 100 0 0 0\n"); return 0;}
  54.     printf("Rutina SCROLL de Andrés del Campo.\n\nPulse ALT-A para activar.\nPulse ALT-B para activar por segunda vez.\nALT-A por tercera... \n\nOjo! Sólo para 320 por 200\n");
  55.     up=atoi(argv[1]);
  56.     down=atoi(argv[2]);
  57.     left=atoi(argv[3])/2;
  58.     right=atoi(argv[4])/2;
  59.     oldhandler = _dos_getvect(INTR);
  60.     _dos_setvect(INTR, handler);
  61.     _dos_keep(0, (_SS + (_SP/16) - _psp));
  62.     return 0;
  63. }
  64.